<template>
    <input type="text" v-model="cityName">
</template>
<script setup>
    import {watch,ref, reactive} from 'vue'
    const cityName = ref('beijing')
    watch(cityName,(newVal,oldVal) =>{
        console.log(newVal,oldVal)
}) 

    const person = reactive({
        name:'zhangsan',
        age:18,
        class:{grade:3}
    })
    watch(person,(newVal,oldVal) =>{
        console.log(newVal,oldVal);
    },{deep:true,immediate:true})
</script>
<style>
</style>